/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package json;

import flexjson.JSONSerializer;
import java.util.HashMap;
import net.sf.json.JSONObject;

/**
 *
 * @author WangShuai
 */
public class Person extends HashMap{
    private int id;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
    private String name;
    private String password;

    public String toJSON() {
        JSONSerializer serializer = new JSONSerializer();
        return serializer.serialize(this);
    }

    public String toJSONIncludeSub() {
        JSONSerializer serializer = new JSONSerializer();
        String str = serializer.serialize(this);
        JSONObject object = JSONObject.fromObject(str);
        object.put("id", id);
        object.put("name", name);
        object.put("password", password);
        return object.toString();
    }
}
